<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
    <title><%= title %></title>

    <link rel='stylesheet' href='/stylesheets/bootstrap.min.css' />
    <script type="text/javascript" src='/javascripts/jquery-1.8.2.min.js'></script>
</head>
<body>
    <div class="container">
        <form role="form">
            <div class="form-group">
                <label for="sourceDate">输入时间戳</label>
                <input type="text" class="form-control" id="sourceDate" placeholder="请输入要转换的时间"/>
            </div>
            <div class="form-group">
                <label for="result">转换后的时间</label>
                <input type="text" class="form-control" id="result" readonly/>
            </div>
            <button type="button" class="btn btn-default" onclick="ajaxDate()">转换</button>
        </form>
    </div>

    <script>
        function ajaxDate() {
            var url = "./tool/format";
            $.getJSON(
                url,
                {
                    source:$("#sourceDate").val(),
                    r: Math.random()
                },
                function (data) {
                    console.log(data);
                    $("#result").val(data.result);
                }
            );
        }
    </script>
</body>
</html>
